package com.study.pool;

import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/** 
* @Description: 无界队列
* @Param:  
* @return:
* @Author: 朝花不迟暮 
* @Date: 2020/5/23 
*/
public class LinkedBlockingQueue
{
    public static void main(String[] args)
    {
        ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(1, 2, 1000, TimeUnit.MILLISECONDS, new LinkedBlockingDeque<>(), Executors.defaultThreadFactory(), new ThreadPoolExecutor.DiscardOldestPolicy());
        for (int i = 0; i < 3; i++)
        {
            poolExecutor.execute(new ThreadTask());
        }
        poolExecutor.shutdown();
    }
}
